AWS IAM Identity Center (formerly AWS SSO)
Detailed Content
AWS IAM Identity Center (formerly AWS Single Sign-On or AWS SSO) is a cloud SSO service that makes it easy to centrally manage SSO access to multiple AWS accounts and business applications. With IAM Identity Center, you can manage user access to all your assigned AWS accounts and applications from a single place. It simplifies the administration of user permissions across a multi-account AWS environment via integration with AWS Organizations.
Core Concepts and Features
- Identity Source: Where your users and groups originate from. IAM Identity Center can use:
- IAM Identity Center directory: An AWS-managed directory where you create and manage your users and groups directly.
- Active Directory: Integrate with AWS Directory Service (Managed Microsoft AD or AD Connector) to use your existing on-premises or AWS-managed Active Directory.
- External Identity Provider (IdP): Integrate with external IdPs that support SAML 2.0 (e.g., Okta, Azure AD, OneLogin).
- Permission Sets: Defines the level of access users have to their assigned AWS accounts. A permission set is a collection of IAM policies (managed or inline) that define specific permissions. They are reusable templates for access.
- Account Assignments: Specifies which users or groups from your identity source have access to which AWS accounts, and with what permission set. This enables fine-grained access control across your AWS Organization.
- User Portal: A centralized web portal where users can find and access all their assigned AWS accounts and business applications with a single sign-on experience.
- AWS Organizations Integration: IAM Identity Center deeply integrates with AWS Organizations, allowing you to centrally manage access to all your member accounts.
- Temporary Credentials: When users sign in through the user portal and access an AWS account, IAM Identity Center automatically provisions temporary AWS credentials (roles) for them. These credentials are short-lived, enhancing security.
- Multi-Account Access: Simplifies the management of users and their access across multiple AWS accounts, which is crucial for organizations adopting a multi-account strategy.
- Application Integration: Integrates with various cloud applications (e.g., Salesforce, Google Workspace) and custom SAML-enabled applications, extending the SSO experience beyond AWS accounts.
Use Cases
- Centralized Multi-Account Access Management: Provide a single place for users to sign in and access all their AWS accounts and cloud applications, simplifying user experience and reducing administrative overhead.
- Streamlined User Provisioning: Automatically provision and deprovision users from your existing corporate directory (e.g., Active Directory) to manage access consistently.
- Enforcing Least Privilege: Define granular permissions using permission sets and assign them to specific users or groups for different AWS accounts, ensuring that users only have the necessary access.
- Compliance and Auditing: Centralize access logs and audit trails, making it easier to demonstrate compliance with security policies and regulations.
- Secure Access for Federating Identities: Integrate with external IdPs to provide secure SSO access for your users, allowing them to use their existing corporate credentials.
- Avoiding Root User Access: Promote the use of federated identities and temporary credentials, reducing the risk associated with using root or long-lived IAM user credentials.
Interview Questions
Conceptual Questions
- What is AWS IAM Identity Center (formerly AWS SSO) and what problem does it solve in a multi-account AWS environment?
- AWS IAM Identity Center is a cloud SSO service that centrally manages SSO access to multiple AWS accounts and business applications. It solves the problem of managing user access across a complex multi-account AWS environment, simplifying user experience, improving security, and reducing administrative overhead.
- Explain the key components of IAM Identity Center: Identity Source, Permission Sets, and Account Assignments.
- Identity Source: Where users and groups are managed (IAM Identity Center directory, Active Directory, or external IdP).
- Permission Sets: Reusable collections of IAM policies that define permissions for users in their assigned AWS accounts.
- Account Assignments: Specifies which users/groups get which permission set in which AWS account.
- How does IAM Identity Center integrate with AWS Organizations?
- IAM Identity Center is deeply integrated with AWS Organizations. It uses the organizational structure to manage and apply permissions across all member accounts from a central management account. This enables consistent access control and management across the entire AWS environment.
- How does IAM Identity Center simplify multi-account access and improve security?
- Simplification: Provides a single sign-on experience for users to access all their AWS accounts and applications through a user portal. Centralizes user and permission management for administrators.
- Security: Uses temporary AWS credentials (roles) when users access accounts, eliminating long-lived credentials. Enforces least privilege through permission sets. Integrates with MFA and allows integration with corporate identity sources.
- When would you integrate IAM Identity Center with an external Identity Provider (IdP) versus using its own directory?
- External IdP (SAML 2.0): Use when your organization already has an existing corporate identity provider (e.g., Okta, Azure AD) and you want users to use their existing credentials to access AWS accounts and applications. This enhances user experience and centralizes identity management.
- IAM Identity Center Directory: Use when you don't have an existing IdP or you prefer for AWS to manage user identities directly within the service. Ideal for smaller organizations or specific projects.
Scenario-Based Questions
- Your organization has adopted a multi-account strategy with separate accounts for development, staging, and production. Developers need access to their respective development accounts, and a smaller group of release engineers needs access to all three environments. You want to centralize user management and ensure a consistent login experience. How would you design this using IAM Identity Center?
- I would deploy AWS IAM Identity Center in my management account. I would configure IAM Identity Center's own directory or integrate it with our existing Active Directory as the identity source. I would then create:
- Permission Set 1 (e.g.,
DeveloperAccess): Granting administrative access to development resources. - Permission Set 2 (e.g.,
ReleaseEngineerAccess): Granting appropriate permissions across dev, staging, and prod.
- Permission Set 1 (e.g.,
- Finally, I would use Account Assignments to:
- Assign developer groups/users with
DeveloperAccessto only their respective development AWS accounts. - Assign release engineer groups/users with
ReleaseEngineerAccessto all dev, staging, and production accounts.
- Assign developer groups/users with
- Users would access AWS environments through the User Portal with a single sign-on.
- I would deploy AWS IAM Identity Center in my management account. I would configure IAM Identity Center's own directory or integrate it with our existing Active Directory as the identity source. I would then create:
- Your company uses Okta as its primary identity provider. You want to streamline user access to AWS accounts in your AWS Organization, allowing users to log in with their Okta credentials and get appropriate permissions based on their job function. How would you integrate Okta with your AWS environment?
- I would integrate Okta (as a SAML 2.0 Identity Provider) with AWS IAM Identity Center. I would configure the trust relationship between Okta and IAM Identity Center. In IAM Identity Center, I would define permission sets corresponding to various job functions (e.g.,
Admin,Developer,Auditor). I would then map Okta groups to these permission sets and assign them to specific AWS accounts in my AWS Organization. Users would log into Okta, and then be redirected to the IAM Identity Center User Portal, where they can choose the AWS account and role they need. This leverages existing corporate identities and simplifies access management.
- I would integrate Okta (as a SAML 2.0 Identity Provider) with AWS IAM Identity Center. I would configure the trust relationship between Okta and IAM Identity Center. In IAM Identity Center, I would define permission sets corresponding to various job functions (e.g.,
- You need to provide temporary access to an external auditor for a specific set of S3 buckets and CloudWatch logs across several AWS accounts in your organization. The auditor already has their own AWS account. How would you manage this access securely with a time limit?
- While AWS Organizations with roles can be used for cross-account access, IAM Identity Center simplifies this. I would create a dedicated user for the auditor in IAM Identity Center (or link their existing IdP identity). I would then define a permission set that grants read-only access to the specific S3 buckets and CloudWatch log groups. In the IAM policy within this permission set, I would add a condition to restrict the session duration using
sts:DurationSeconds. I would then use Account Assignments to grant this auditor user/group the auditor permission set to the specific AWS accounts for a limited time.
- While AWS Organizations with roles can be used for cross-account access, IAM Identity Center simplifies this. I would create a dedicated user for the auditor in IAM Identity Center (or link their existing IdP identity). I would then define a permission set that grants read-only access to the specific S3 buckets and CloudWatch log groups. In the IAM policy within this permission set, I would add a condition to restrict the session duration using
Coding/CLI Examples
Here are some common AWS IAM Identity Center operations using the AWS CLI and Python (Boto3).
AWS CLI Examples
-
List instances of IAM Identity Center:
bash aws sso-admin list-instances -
Describe a Permission Set: ```bash INSTANCE_ARN="arn:aws:sso:::instance/ssoins-xxxxxxxxxxxxxxxxx" # Replace with your Instance ARN PERMISSION_SET_ARN="arn:aws:sso:::permissionSet/ssoins-xxxxxxxxxxxxxxxxx/ps-xxxxxxxxxxxxxxxxx" # Replace with your Permission Set ARN
aws sso-admin describe-permission-set \ --instance-arn $INSTANCE_ARN \ --permission-set-arn $PERMISSION_SET_ARN ```
-
Create a Permission Set: ```bash INSTANCE_ARN="arn:aws:sso:::instance/ssoins-xxxxxxxxxxxxxxxxx" # Replace with your Instance ARN
aws sso-admin create-permission-set \ --instance-arn $INSTANCE_ARN \ --name ReadOnlyAccessToS3AndCloudWatch \ --description "Read-only access to S3 and CloudWatch" \ --session-duration P1H # 1 hour session duration ```
-
Attach an AWS Managed Policy to a Permission Set: ```bash INSTANCE_ARN="arn:aws:sso:::instance/ssoins-xxxxxxxxxxxxxxxxx" # Replace with your Instance ARN PERMISSION_SET_ARN="arn:aws:sso:::permissionSet/ssoins-xxxxxxxxxxxxxxxxx/ps-xxxxxxxxxxxxxxxxx" # Replace with your Permission Set ARN
aws sso-admin attach-managed-policy-to-permission-set \ --instance-arn $INSTANCE_ARN \ --permission-set-arn $PERMISSION_SET_ARN \ --managed-policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess ```
-
Create an Account Assignment (assign a user/group to an account with a permission set): ```bash INSTANCE_ARN="arn:aws:sso:::instance/ssoins-xxxxxxxxxxxxxxxxx" # Replace with your Instance ARN PERMISSION_SET_ARN="arn:aws:sso:::permissionSet/ssoins-xxxxxxxxxxxxxxxxx/ps-xxxxxxxxxxxxxxxxx" # Replace with your Permission Set ARN ACCOUNT_ID="123456789012" # Replace with the AWS Account ID PRINCIPAL_ID="1234567890-ABCDEFGHIJK_LMNOPQRSTUVWXYZ" # Replace with the User ID or Group ID from your Identity Source
For a user:
# aws sso-admin create-account-assignment \ # --instance-arn $INSTANCE_ARN \ # --target-id $ACCOUNT_ID \ # --target-type AWS_ACCOUNT \ # --permission-set-arn $PERMISSION_SET_ARN \ # --principal-type USER \
--principal-id $PRINCIPAL_ID
For a group:
aws sso-admin create-account-assignment \ --instance-arn $INSTANCE_ARN \ --target-id $ACCOUNT_ID \ --target-type AWS_ACCOUNT \ --permission-set-arn $PERMISSION_SET_ARN \ --principal-type GROUP \ --principal-id $PRINCIPAL_ID ```
Python (Boto3) Examples
First, ensure you have Boto3 installed (pip install boto3) and your AWS credentials configured.
-
List IAM Identity Center instances: ```python import boto3
sso_admin_client = boto3.client('sso-admin')
try: response = sso_admin_client.list_instances() print("IAM Identity Center Instances:") for instance in response['Instances']: print(f"- Name: {instance.get('IdentityStoreId')}, ARN: {instance['InstanceArn']}") except Exception as e: print(f"Error listing instances: {e}") ```
-
Create a Permission Set: ```python import boto3 import json
sso_admin_client = boto3.client('sso-admin')
instance_arn = "arn:aws:sso:::instance/ssoins-xxxxxxxxxxxxxxxxx" # REPLACE with your Instance ARN permission_set_name = "MyBoto3PermissionSet"
try: response = sso_admin_client.create_permission_set( InstanceArn=instance_arn, Name=permission_set_name, Description="Permission set created with Boto3", SessionDuration='PT1H' # 1 hour session duration ) permission_set_arn = response['PermissionSet']['PermissionSetArn'] print(f"Created Permission Set {permission_set_name}: {permission_set_arn}")
# Attach an inline policy (example) inline_policy = { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetObject", "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::my-boto3-bucket/*", "arn:aws:s3:::my-boto3-bucket" ] } ] } sso_admin_client.put_inline_policy_to_permission_set( InstanceArn=instance_arn, PermissionSetArn=permission_set_arn, InlinePolicy=json.dumps(inline_policy) ) print("Attached inline policy to permission set.")except Exception as e: print(f"Error creating permission set: {e}") ```
-
Assign a group to an AWS account with a permission set: ```python import boto3
sso_admin_client = boto3.client('sso-admin')
instance_arn = "arn:aws:sso:::instance/ssoins-xxxxxxxxxxxxxxxxx" # REPLACE with your Instance ARN permission_set_arn = "arn:aws:sso:::permissionSet/ssoins-xxxxxxxxxxxxxxxxx/ps-xxxxxxxxxxxxxxxxx" # REPLACE with your Permission Set ARN account_id = "123456789012" # REPLACE with the AWS Account ID group_id = "d-xxxxxxxxxx" # REPLACE with the Group ID from your Identity Source (Identity Store)
try: response = sso_admin_client.create_account_assignment( InstanceArn=instance_arn, TargetId=account_id, TargetType='AWS_ACCOUNT', PermissionSetArn=permission_set_arn, PrincipalType='GROUP', PrincipalId=group_id ) print(f"Account assignment created for Group {group_id} to Account {account_id} with Permission Set {permission_set_arn}.") except Exception as e: print(f"Error creating account assignment: {e}") ```